package com.zone.sdk.module.account;

import com.zone.sdk.common.http.base.Result;
import com.zone.sdk.module.account.entity.CaptchaCertExchangeEntity;
import com.zone.sdk.module.account.entity.CaptchaGetEntity;
import com.zone.sdk.module.account.entity.CheckCaptchaEntity;
import com.zone.sdk.module.account.entity.LoginEntity;
import com.zone.sdk.module.account.entity.LoginStatusEntity;
import com.zone.sdk.module.account.entity.QrLoginEntity;
import com.zone.sdk.module.account.entity.QrLoginPollEntity;
import com.zone.sdk.module.account.entity.UploadEntity;
import com.zone.sdk.module.account.entity.UserInfoEntity;
import com.zone.sdk.module.account.request.CaptchaCertExchangeRequest;
import com.zone.sdk.module.account.request.CaptchaGetRequest;
import com.zone.sdk.module.account.request.CheckCaptchaRequest;
import com.zone.sdk.module.account.request.LoginRequest;
import com.zone.sdk.module.account.request.LogoutRequest;
import com.zone.sdk.module.account.request.QrLoginPollRequest;
import com.zone.sdk.module.account.request.QrLoginRequest;
import com.zone.sdk.module.account.request.RefreshTokenRequest;
import com.zone.sdk.module.account.request.UploadRequest;
import com.zone.sdk.module.account.request.UserInfoRequest;
import com.zone.sdk.module.account.response.CaptchaGetResponse;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

public interface ICloudAccountService {


    /*********************************************账号体系***************************************/

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("captcha/get")
    Observable<CaptchaGetResponse<CaptchaGetEntity>> captchaGet(@Body CaptchaGetRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("captcha/check")
    Observable<CaptchaGetResponse<CheckCaptchaEntity>> checkCaptcha(@Body CheckCaptchaRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/captchacert/exchange/v1")
    Observable<Result<CaptchaCertExchangeEntity>> captchaCertExchange(@Body CaptchaCertExchangeRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/login/phonecode/v1")
    Observable<Result<LoginEntity>> loginPhoneCode(@Body LoginRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/login/phonepwd/v1")
    Observable<Result<LoginEntity>> loginPhonePwd(@Body LoginRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/passwd/modified/v1")
    Observable<Result> userPwdModify(@Body LoginRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @GET("user/info/v1")
    Observable<Result<UserInfoEntity>> queryUserInfo();

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/info/v1")
    Observable<Result> updateUserInfo(@Body UserInfoRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/logout/v1")
    Observable<Result> logout(@Body LogoutRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/refreshtoken/v1")
    Observable<Result<LoginEntity>> refreshToken(@Body RefreshTokenRequest request);

    /**
     *
     * @param body RequestBody mbody = new MultipartBody.Builder()
     *                     .addFormDataPart("file-type", "profile")
     *                     .addFormDataPart("files", "image.png", body)
     *                     .build();
     * @param request
     * @return
     */
    @Multipart
    @POST("file/upload/v1")
    Observable<Result<UploadEntity>> userUpload(@Part("files") RequestBody body, @Body UploadRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @GET("user/login/status/v1")
    Observable<Result<LoginStatusEntity>> loginStatus();

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/qrlogin/generate/v1")
    Observable<Result<QrLoginEntity>> qrLoginCode(@Body QrLoginRequest request);

    @Headers({"Content-Type: application/json;charset=utf-8",
            "Accept: application/json;charset=utf-8"})
    @POST("user/qrlogin/polling/v1")
    Observable<Result<QrLoginPollEntity>> qrLoginPolling(@Body QrLoginPollRequest request);

    /************************************************************************************/

}
